package exercise.coroutine.easy.q1;

import cn.hutool.core.date.DateUtil;

import java.util.Date;
import java.util.concurrent.TimeUnit;

public class CommodityService {

    public static Commodity getCommodityById(Long id) throws InterruptedException {
        Commodity commodity = new Commodity();
        commodity.setId(2L);
        commodity.setName("电脑");
        commodity.setPrice(6000.0);
        commodity.setDescription("这是个好电脑");
        commodity.setProductDate(new Date());
        commodity.setExpirationDate(DateUtil.offsetMinute(new Date(), 60));
        TimeUnit.SECONDS.sleep(3);
        System.out.println(Thread.currentThread() + "查询商品接口执行完毕" +  + System.currentTimeMillis());
        return commodity;
    }
}
